<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Bootstrap-按钮&折叠</title>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="jquery-3.2.1.js"></script>
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <button id="fat-btn" class="btn btn-primary" data-loading-text="Loading..." type="button">加载状态</button>
    <button type="button" class="btn btn-info" data-toggle="button">单个切换</button>
    <div class="btn-group" data-toggle="buttons">
        <label class="btn btn-primary"><input type="checkbox">选项1</label>
        <label class="btn btn-primary"><input type="checkbox">选项2</label>
        <label class="btn btn-primary"><input type="checkbox">选项3</label>
    </div>

    <br>

    <h2>点击每个按钮查看方法效果</h2>
    <h4>演示.button('toggle')</h4>
    <div id="myButtons1" class="bs-example">
        <button type="button" class="btn btn-primary">原始</button>
    </div>
    <h4>演示.button('loading')</h4>
    <div id="myButtons2" class="bs-example">
        <button data-loading-text="Loading" type="button" class="btn btn-primary">原始</button>
    </div>
    <h4>演示 .button(string) 方法</h4>
    <button type="button" class="btn btn-primary" id="myButton4" data-warning-text="Loading finished">请点击我</button>

    <br><br><br>
    <div class="panel-group" id="accordion">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">点击我展开</a>
                </h4>
            </div>
            <div class="panel-collapse collapse in" id="collapseOne" >
                <div class="panel-body">
                    Nihil anim keffiyeh helvetica, craft beer labore wes anderson
                    cred nesciunt sapiente ea proident. Ad vegan excepteur butcher
                    vice lomo.
                </div>
            </div>
        </div>
    </div>

</div>

<script>
    $(function () {
       $("#fat-btn").click(function () {
           $(this).button("loading").delay(1000).queue(function () {
               $(this).button("reset");
           });
       });


    });
    $(function () {
        $("#myButtons1 .btn").click(function () {
            $(this).button('toggle');
        });
    })
    $(function () {
        $("#myButtons2 .btn").click(function () {
            $(this).button("loading").delay(1000).queue(function () {
                $(this).button("reset");
            });
        });
    })
    $(function () {
        $("#myButton4").click(function () {
            $(this).button("loading").delay(1000).queue(function () {
               $(this).button("warning");
            });
        });
    })
    $(function () {
        //$(".collapse").collapse("toggle");
    });
    $(function () {
        $(".collapse").on("hidden.bs.collapse",function () {
            alert("隐藏掉了");
        })
    })
</script>
</body>
</html>